<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>websocket::role_type</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Beast">
<link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2">
<link rel="prev" href="boost__beast__websocket__response_type.html" title="websocket::response_type">
<link rel="next" href="boost__beast__websocket__seed_prng.html" title="websocket::seed_prng">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost__beast__websocket__response_type.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__websocket__seed_prng.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="beast.ref.boost__beast__websocket__role_type"></a><a class="link" href="boost__beast__websocket__role_type.html" title="websocket::role_type">websocket::role_type</a>
</h4></div></div></div>
<p>
        <a class="indexterm" name="idp134483776"></a>
The role of the websocket stream endpoint.
      </p>
<h5>
<a name="beast.ref.boost__beast__websocket__role_type.h0"></a>
        <span class="phrase"><a name="beast.ref.boost__beast__websocket__role_type.synopsis"></a></span><a class="link" href="boost__beast__websocket__role_type.html#beast.ref.boost__beast__websocket__role_type.synopsis">Synopsis</a>
      </h5>
<p>
        Defined in header <code class="literal">&lt;<a href="../../../../../../boost/beast/websocket/role.hpp" target="_top">boost/beast/websocket/role.hpp</a>&gt;</code>
      </p>
<pre class="programlisting"><span class="keyword">enum</span> <span class="identifier">role_type</span>
</pre>
<p>
        <a class="indexterm" name="idp134491712"></a>
 <a class="indexterm" name="idp134492816"></a>

      </p>
<h5>
<a name="beast.ref.boost__beast__websocket__role_type.h1"></a>
        <span class="phrase"><a name="beast.ref.boost__beast__websocket__role_type.values"></a></span><a class="link" href="boost__beast__websocket__role_type.html#beast.ref.boost__beast__websocket__role_type.values">Values</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Name
                </p>
              </th>
<th>
                <p>
                  Description
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <code class="literal">client</code>
                </p>
              </td>
<td>
                <p>
                  The stream is operating as a client.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="literal">server</code>
                </p>
              </td>
<td>
                <p>
                  The stream is operating as a server.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="beast.ref.boost__beast__websocket__role_type.h2"></a>
        <span class="phrase"><a name="beast.ref.boost__beast__websocket__role_type.description"></a></span><a class="link" href="boost__beast__websocket__role_type.html#beast.ref.boost__beast__websocket__role_type.description">Description</a>
      </h5>
<p>
        Whether the endpoint is a client or server affects the behavior of the <span class="emphasis"><em>Close
        the WebSocket Connection</em></span> operation described in rfc6455 section
        7.1.1. The shutdown behavior depends on the type of the next layer template
        parameter used to construct the <a class="link" href="boost__beast__websocket__stream.html" title="websocket::stream"><code class="computeroutput"><span class="identifier">websocket</span><span class="special">::</span><span class="identifier">stream</span></code></a>. Other next layer types including
        user-defined types may implement different role-based behavior when performing
        the close operation.
      </p>
<p>
        The default implementation for <a class="link" href="boost__beast__websocket__stream.html" title="websocket::stream"><code class="computeroutput"><span class="identifier">websocket</span><span class="special">::</span><span class="identifier">stream</span></code></a> when the next layer type
        is a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code>
        behaves as follows:
      </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            In the client role, a TCP/IP shutdown is sent after reading all remaining
            data on the connection.
          </li>
<li class="listitem">
            In the server role, a TCP/IP shutdown is sent before reading all remaining
            data on the connection.
          </li>
</ul></div>
<p>
        When the next layer type is a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span></code>, the connection is closed by performing
        the SSL closing handshake corresponding to the role type, client or server.
      </p>
<h5>
<a name="beast.ref.boost__beast__websocket__role_type.h3"></a>
        <span class="phrase"><a name="beast.ref.boost__beast__websocket__role_type.see_also"></a></span><a class="link" href="boost__beast__websocket__role_type.html#beast.ref.boost__beast__websocket__role_type.see_also">See Also</a>
      </h5>
<p>
        <a href="https://tools.ietf.org/html/rfc6455#section-7.1.1" target="_top">https://tools.ietf.org/html/rfc6455#section-7.1.1</a>
      </p>
<p>
        Convenience header <code class="literal">&lt;<a href="../../../../../../boost/beast/websocket.hpp" target="_top">boost/beast/websocket.hpp</a>&gt;</code>
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2016, 2017 Vinnie Falco<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost__beast__websocket__response_type.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__websocket__seed_prng.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
